#include "widget.h"
#include "ui_widget.h"
#include<time.h>
#include<QDebug>
#include<QMoveEvent>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
   timerId= this->startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timerEvent(QTimerEvent *event)
{
    if(event->timerId()!=this->timerId)
    {
        return ;
    }
    int value=ui->lcdNumber->value();
    if(value<=0)
    {
        this->killTimer(this->timerId);
        return ;
    }
    value-=1;
    ui->lcdNumber->display(value);
//    if(value<=0)
//    {
//        int value=10;
//        ui->lcdNumber->display(value);
    //    }
}

void Widget::moveEvent(QMoveEvent *event)
{
    (void)event;
    qDebug()<<this->pos();
}

void Widget::resizeEvent(QResizeEvent *event)
{
    (void)event;
    qDebug()<<this->size();
}

